package com.jprocms.module.cms.controller.admin.vote.vo;

import com.jprocms.module.cms.controller.admin.voteitem.vo.VoteItemCreateReqVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.util.List;

@Schema(description = "管理后台 - 投票创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class VoteCreateReqVO extends VoteBaseVO {

    @Schema(description = "选项集合", example = "16241")
    private List<VoteItemCreateReqVO> items;

    public void init() {
        if (getVoteMode() == null) {
            setVoteMode((short) 1);
        }
        if (getVoteInterval() == null) {
            setVoteInterval(0);
        }
        setVoteNum(0);
        if (getVoteMultiple() == null) {
            setVoteMultiple(true);
        }
        if (getEnabled() == null) {
            setEnabled(true);
        }
    }

}
